//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit3.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFormIOByLID *FormIOByLID;
unsigned char IOControlByLocalID0[8]={0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char IOControlByLocalID1[8]={0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char IOControlByLocalID2[8]={0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char Default=0,On=1,Off=0;
//---------------------------------------------------------------------------
__fastcall TFormIOByLID::TFormIOByLID(TComponent* Owner)
        : TForm(Owner)
{
CLBChery->Enabled=false;
CLBOthers->Enabled=false;
CLBKeyStatus->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TFormIOByLID::SelectFinishClick(TObject *Sender)
{
if (CBChery->Checked==false&&CBOthers->Checked==false&&CBKeyStatus->Checked==false)
ShowMessage("Please Select Which IO You Should Set Up");
else
FormIOByLID->Close();
}
//---------------------------------------------------------------------------
void __fastcall TFormIOByLID::CBCheryClick(TObject *Sender)
{
if (CBChery->Checked==true)
CLBChery->Enabled=true;
else
CLBChery->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TFormIOByLID::CBOthersClick(TObject *Sender)
{
if (CBOthers->Checked==true)
CLBOthers->Enabled=true;
else
CLBOthers->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TFormIOByLID::CBKeyStatusClick(TObject *Sender)
{
if (CBKeyStatus->Checked==true)
CLBKeyStatus->Enabled=true;
else
CLBKeyStatus->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TFormIOByLID::FormActivate(TObject *Sender)
{
if (MainForm->ReturnToECU->Checked==true)
IOControlByLocalID0[3]=0x00;
else
    {
    if (MainForm->ReportStatus->Checked==true)
    IOControlByLocalID0[3]=0x01;
    else
        {
         if (MainForm->ShortTADJ->Checked==true)
         IOControlByLocalID0[3]=0x07;
         else
         IOControlByLocalID0[3]=0x00;
        }
    }        
}
//---------------------------------------------------------------------------
void __fastcall TFormIOByLID::CLBCheryClick(TObject *Sender)
{
 int i;
  switch (CLBChery->ItemIndex)
        {
        case 0:
             if (CLBChery->Checked[0]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x01;

             IOControlByLocalID0[4]=0x01;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 1:
             if (CLBChery->Checked[1]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x01;

             IOControlByLocalID0[4]=0x01;
             IOControlByLocalID0[5]=0x00;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x01;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 2:
             if (CLBChery->Checked[2]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x01;

             IOControlByLocalID0[4]=0x02;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 3:
             if (CLBChery->Checked[3]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x01;

             IOControlByLocalID0[4]=0x02;
             IOControlByLocalID0[5]=0x00;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x01;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 4:
             if (CLBChery->Checked[4]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x01;

             IOControlByLocalID0[4]=0x03;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 5:
             if (CLBChery->Checked[5]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x01;

             IOControlByLocalID0[4]=0x03;
             IOControlByLocalID0[5]=0x00;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x01;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 6:
             if (CLBChery->Checked[6]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x01;

             IOControlByLocalID0[4]=0x04;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 7:
             if (CLBChery->Checked[7]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x01;

             IOControlByLocalID0[4]=0x04;
             IOControlByLocalID0[5]=0x00;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x01;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 8:   //wiper inc
             if (CLBChery->Checked[8]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x02;

             IOControlByLocalID0[4]=0x01;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 9:   //wiper dec
             if (CLBChery->Checked[9]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x02;

             IOControlByLocalID0[4]=0x01;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 10:   //Front wiper park
             if (CLBChery->Checked[10]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x02;

             IOControlByLocalID0[4]=0x01;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 11:  //front washer
             if (CLBChery->Checked[11]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x02;

             IOControlByLocalID0[4]=0x01;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 12: //Front wiper low
             if (CLBChery->Checked[12]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x02;

             IOControlByLocalID0[4]=0x04;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 13: //Front wiper Hi
             if (CLBChery->Checked[13]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x02;

             IOControlByLocalID0[4]=0x03;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 14:   //Rear wiper
             if (CLBChery->Checked[14]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x02;

             IOControlByLocalID0[4]=0x01;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 15:    //Rear washer
             if (CLBChery->Checked[15]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x02;

             IOControlByLocalID0[4]=0x02;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;

        case 16:  //Lock
             if (CLBChery->Checked[16]==true)
             {
             IOControlByLocalID0[0]=0x04;
             IOControlByLocalID0[2]=0x03;

             IOControlByLocalID0[4]=0x01;
             IOControlByLocalID0[5]=0x00;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[4]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 17:
             if (CLBChery->Checked[17]==true)
             {
             IOControlByLocalID0[0]=0x04;
             IOControlByLocalID0[2]=0x03;

             IOControlByLocalID0[4]=0x00;
             IOControlByLocalID0[5]=0x00;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[4]=0x01;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;

        case 18:
             if (CLBChery->Checked[18]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x04;

             IOControlByLocalID0[4]=0x01;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 19:
             if (CLBChery->Checked[19]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x04;

             IOControlByLocalID0[4]=0x02;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 20:
             if (CLBChery->Checked[20]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x04;

             IOControlByLocalID0[4]=0x03;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 21:
             if (CLBChery->Checked[21]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x04;

             IOControlByLocalID0[4]=0x04;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 22:
             if (CLBChery->Checked[22]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x04;

             IOControlByLocalID0[4]=0x05;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        case 23:
             if (CLBChery->Checked[23]==true)
             {
             IOControlByLocalID0[0]=0x05;
             IOControlByLocalID0[2]=0x04;

             IOControlByLocalID0[4]=0x06;
             IOControlByLocalID0[5]=0x01;
             for (i=0;i<24;i++)
                 {
                 if (CLBChery->ItemIndex!=i)
                 {
                 CLBChery->ItemEnabled[i]=false;
                 CLBChery->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID0[5]=0x00;
              for (i=0;i<24;i++)
                 {
                  CLBChery->ItemEnabled[i]=true;
                 }
            }
        break;
        }
}
//---------------------------------------------------------------------------

void __fastcall TFormIOByLID::CLBOthersClick(TObject *Sender)
{
int i;
  switch (CLBOthers->ItemIndex)
        {
        case 0:// Tamper
             if (CLBOthers->Checked[0]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x1B;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 1: //horn
             if (CLBOthers->Checked[1]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x1d;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 2:  //boot release
             if (CLBOthers->Checked[2]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x28;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 3://high beam flash
             if (CLBOthers->Checked[3]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x25;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 4://Reverse gear
             if (CLBOthers->Checked[4]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x1e;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 5://Park gear
             if (CLBOthers->Checked[5]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x1f;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 6:  //front fog
             if (CLBOthers->Checked[6]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x23;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 7://rear fog
             if (CLBOthers->Checked[7]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x22;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 8: //front defroster
             if (CLBOthers->Checked[8]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x2a;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 9: //rear defroster
             if (CLBOthers->Checked[9]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x29;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 10:  //cruise on
             if (CLBOthers->Checked[10]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x18;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 11:   //cruise set
             if (CLBOthers->Checked[11]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x19;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 12: //cruise resume
             if (CLBOthers->Checked[12]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x1a;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 13:  //fl door ajar
             if (CLBOthers->Checked[13]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x13;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 14:  //fr door ajar
             if (CLBOthers->Checked[14]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x14;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 15: //rl door ajar
             if (CLBOthers->Checked[15]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x15;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 16: //rr door ajar
             if (CLBOthers->Checked[16]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x16;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 17: //boot door ajar
             if (CLBOthers->Checked[17]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x17;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 18: //hood door ajar
             if (CLBOthers->Checked[18]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x20;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 19: //siren
             if (CLBOthers->Checked[19]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x2d;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 20:  //battery saver
             if (CLBOthers->Checked[20]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x2e;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 21:  //nozzle heater
             if (CLBOthers->Checked[21]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x2f;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        case 22: //key lock
             if (CLBOthers->Checked[22]==true)
             {
             IOControlByLocalID1[0]=0x04;
             IOControlByLocalID1[2]=0x30;

             IOControlByLocalID1[3]=0x01;
             IOControlByLocalID1[4]=0x01;
             for (i=0;i<23;i++)
                 {
                 if (CLBOthers->ItemIndex!=i)
                 {
                 CLBOthers->ItemEnabled[i]=false;
                 CLBOthers->Checked[i]=false;
                 }
                 else
                 ;
                 }
            }
            else
            {
              IOControlByLocalID1[4]=0x00;
              for (i=0;i<23;i++)
                 {
                  CLBOthers->ItemEnabled[i]=true;
                 }
            }
        break;
        }        
}
//---------------------------------------------------------------------------

void __fastcall TFormIOByLID::CLBKeyStatusClick(TObject *Sender)
{
 int k;
  switch (CLBKeyStatus->ItemIndex)
        {
        case 0:
              if (CLBKeyStatus->Checked[0]==true)
                 {
                  IOControlByLocalID2[0]=0x04;
                  IOControlByLocalID2[2]=0x1C;

                  IOControlByLocalID2[3]=0x01;
                  IOControlByLocalID2[4]=0x01;
                  for (k=0;k<3;k++)
                      {
                      if (CLBKeyStatus->ItemIndex!=k)
                      {
                      CLBKeyStatus->ItemEnabled[k]=false;
                      CLBKeyStatus->Checked[k]=false;
                      }
                      else
                      ;
                      }

                 }
              else
                    {
                    IOControlByLocalID2[4]=0x00;
                    for (k=0;k<3;k++)
                        {
                        CLBKeyStatus->ItemEnabled[k]=true;
                        }
                    }
        break;
        case 1:
              if (CLBKeyStatus->Checked[1]==true)
                 {
                  IOControlByLocalID2[0]=0x04;
                  IOControlByLocalID2[2]=0x10;

                  IOControlByLocalID2[3]=0x01;
                  IOControlByLocalID2[4]=0x01;
                  for (k=0;k<3;k++)
                      {
                      if (CLBKeyStatus->ItemIndex!=k)
                      {
                      CLBKeyStatus->ItemEnabled[k]=false;
                      CLBKeyStatus->Checked[k]=false;
                      }
                      else
                      ;
                      }

                 }
              else
                    {
                    IOControlByLocalID2[4]=0x00;
                    for (k=0;k<3;k++)
                        {
                        CLBKeyStatus->ItemEnabled[k]=true;
                        }
                    }
        break;
        case 2:
              if (CLBKeyStatus->Checked[2]==true)
                 {
                  IOControlByLocalID2[0]=0x04;
                  IOControlByLocalID2[2]=0x11;
                  
                  IOControlByLocalID2[3]=0x01;
                  IOControlByLocalID2[4]=0x01;
                  for (k=0;k<3;k++)
                      {
                      if (CLBKeyStatus->ItemIndex!=k)
                      {
                      CLBKeyStatus->ItemEnabled[k]=false;
                      CLBKeyStatus->Checked[k]=false;
                      }
                      else
                      ;
                      }

                 }
              else
                    {
                    IOControlByLocalID2[4]=0x00;
                    for (k=0;k<3;k++)
                        {
                        CLBKeyStatus->ItemEnabled[k]=true;
                        }
                    }
        break;
        }        
}
//---------------------------------------------------------------------------

